package enumDemo;

public enum TestEnum {
    RISE(0,"RISE"),NOODLES(1,"NOODLES"),BREAD(2,"BREAD"),
    SANDWICH(3,"SANDWICH"),BEER(4,"BEER");
    public int ordinal;
    public String food;
    TestEnum(int ordinal,String food){
        this.ordinal = ordinal;
        this.food = food;
    }

    public static void main1(String[] args) {
        TestEnum[] testEnum = TestEnum.values();
        for (int i = 0; i < testEnum.length; i++) {
            System.out.println(testEnum[i]+" "+testEnum[i].ordinal);
        }
        TestEnum testEnum1 =  TestEnum.valueOf("RISE");
        System.out.println(testEnum1);

    }

    public static void main(String[] args) {
        TestEnum testEnum = NOODLES;
        switch (testEnum){
            case BREAD :
                System.out.println("BREAD");
            case NOODLES:
                System.out.println("NOODLES");
            default:
                System.out.println("不符合要求");
        }
    }
}
